import { RouterMap } from "./decorators/Web";

import IndexController from "./controllers/IndexController";
import NewsController from "./controllers/NewsController";
import DetailController from "./controllers/DetailController";
import JkscController from "./controllers/JkscController";
import IntroController from "./controllers/IntroController";

new IndexController();
new NewsController();
new DetailController();
new JkscController();
new IntroController();

export function init(app: any) {
  RouterMap.__DecoratedRouters.forEach((controller: any, config: any) => {
    let controllers = Array.isArray(controller) ? controller : [controller];
    controllers.forEach((controller) => {
      app[config.method](config.path, controller);
    });
  });
}
